@extends('Admin.layout.layout')
@section('title','添加品种')
@section('url','/admin/varieties/')
@section('home','品种管理')
@section('weizhi','添加品种')
@section('con')
<script type="text/javascript" src="/bootcss/admin/js/jquery-1.8.3.min.js"></script>
<style type="text/css">
  .zyc > span > s{
    display: inline-block;
    height: 21px;
    width: 22px;
    background: url(/bootcss/admin/img/delete.png) no-repeat center;
    vertical-align: middle;
    cursor: pointer;
    position: relative;
    top: -1px;
  }

</style>


<div class="panel-body">
  <div class="form">
      <form class="form-validate form-horizontal" id="feedback_form" method="post" action="{{url('/admin/varieties/insert')}}" enctype="multipart/form-data" novalidate="novalidate">
          <div class="form-group ">
              <label for="cname" class="control-label col-lg-2">品名<span class="required">*</span></label>
              <div class="col-lg-10" style="width: 300px;">
                  <input class="form-control" id="cname" name="name" minlength="5" type="text" required="">
              </div>
          </div>
          <div class="form-group ">
              <label for="curl" class="control-label col-lg-2">首字母<span class="required">*</span></label>
              <div class="col-lg-10" style="width: 560px;">
                  <!-- <input class="form-control " id="first" type="select" name="first"> -->
                  @foreach($first as $k => $v)
                   <label><input style="margin-left: 15px;margin-top: 13px;" id="time" name="first" minlength="5" type="radio" value="{{$v}}">{{$v}}</label>
                  @endforeach
              </div>
          </div>
          <div class="form-group ">
              <label for="cname" class="control-label col-lg-2">品名缩写 <span class="required">*</span></label>
              <div class="col-lg-10" style="width: 300px;">
                  <input class="form-control" id="subject" name="pinyin" minlength="5" type="text" required="">
              </div>
          </div>  
          <div class="form-group ">
              <label for="cname" class="control-label col-lg-2">英文名 <span class="required">*</span></label>
              <div class="col-lg-10" style="width: 300px;">
                  <input class="form-control" id="subject" name="eName" minlength="5" type="text" required="">
              </div>
          </div>                                      
          <div class="form-group ">
              <label for="ccomment" class="control-label col-lg-2">别名<span class="required">*</span></label>
              <div class="col-lg-10" style="width: 300px;">
                  <input class="form-control" id="subject" name="aliasName" minlength="5" type="text" required="">
              </div>
          </div>
          <div class="form-group">
              <label for="ccomment" class="control-label col-lg-2">药材属性<span class="required">*</span></label>
              <div class="col-lg-10" style="width: 300px;">
                  <div class="properties form-control zyc" minlength="5" style="position:absolute;float: left;"></div>
                  <input class="form-control" id="properties" name="properties" type="hidden" value="">
                  <select  name="" id="ycsx" class="form-control" style="position:absolute;float: left;margin-left:320px">
                  @foreach($sx as $k => $v)
                    <option class='sx' value="">{{$v}}</option>
                  @endforeach
                  </select>
              </div>
          </div>
          <div class="form-group ">
              <label for="ccomment" class="control-label col-lg-2">产新时间<span class="required">*</span></label>
              <div class="col-lg-10" style="width: 900px;">
                  @foreach($time as $k => $v)
                   <input style="margin-left: 15px;margin-top: 13px;" id="time" classs="time" name="time[]" minlength="5" type="checkbox" value="{{$v}}">{{$v}}
                  @endforeach
              </div>
          </div>
          <div class="form-group ">
              <label for="ccomment" class="control-label col-lg-2">产区分布<span class="required">*</span></label>
              <div class="col-lg-10" style="width: 300px;">
                  <div class="area form-control zyc" minlength="5" style="position:absolute;float: left;"></div>
                  <input class="form-control" id="area" name="area" type="hidden" value="">
                  <select  name="" id="cqfb" class="form-control" style="position:absolute;float: left;margin-left:320px">
                  @foreach($area as $k => $v)
                    <option class="from" value="">{{$v}}</option>
                  @endforeach
                  </select>
              </div>
          </div>
           <div class="form-group ">
              <label for="ccomment" class="control-label col-lg-2">品种图<span class="required">*</span></label>
              <div class="col-lg-10" style="width: 300px;">
                   <input name="image" type="file" id="fileUpload">
              </div>
              <p class="help-block">最大不超过2MB</p>
          </div>
          {{csrf_field()}}
          <div class="form-group">
              <div class="col-lg-offset-2 col-lg-10">
                  <button class="btn btn-primary" type="submit">提交</button>
                  <button class="btn btn-default" type="button">取消</button>
              </div>
          </div>
      </form>
  </div>

</div>

  <!-- 品种特点js -->
  <script type="text/javascript">
      // alert($);
      $("#ycsx .sx").live('click',function(){
          var ycsx = $(this).html();
          var info = '';
          info += '<span id="ystag" style="display:inline-block">';
          info += '<i class="lblsx" placeid="0">'+ycsx+'</i>';
          info += '<s id="btnDelPlace"></s>';
          info += '</span>';
          $(".properties").append(info);
          var lblsx = $(".lblsx");
          var insx = '';
          for(var i = 0;i < lblsx.length;i++){
            insx += lblsx.eq(i).html()+',';
          }
          $("#properties").val(insx);
      });

      $("#btnDelPlace").live('click', function(){
          $(this).parent().remove();
          var lblsx = $(".lblsx");
          var insx = '';
          for(var i = 0;i < lblsx.length;i++){
            insx += lblsx.eq(i).html()+',';
          }
          $("#properties").val(insx);
      });
  </script>

  <!-- 地区js -->
  <script type="text/javascript">
      // alert($);
      $("#cqfb .from").live('click',function(){
          var cqfb = $(this).html();
          // alert(cqfb);
          var info = '';
          info += '<span id="ystag" style="display:inline-block">';
          info += '<i class="lblcq" placeid="0">'+cqfb+'</i>';
          info += '<s id="btncqDelPlace"></s>';
          info += '</span>';
          $(".area").append(info);
          var lblcq = $(".lblcq");
          var incq = '';
          for(var i = 0;i < lblcq.length;i++){
            incq += lblcq.eq(i).html()+',';
          }
          $("#area").val(incq);
          console.log(incq);
          console.log($("#area"));
      });

      $("#btncqDelPlace").live('click', function(){
          $(this).parent().remove();
          var lblcq = $(".lblcq");
          var incq = '';
          for(var i = 0;i < lblcq.length;i++){
            incq += lblcq.eq(i).html()+',';
          }
          $("#area").val(incq);
          console.log(incq);
          console.log($("#area"));
      });
  </script>

  <!-- 首字母,时间处理 -->
  <script type="text/javascript">
    
  </script>

@endsection